package guda.house.biz.form.rule;

import guda.house.biz.util.PriceUtil;
import guda.house.dal.dataobject.WaterRuleDO;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;


public class WaterRuleForm {

    @NotNull(message = "不能为空")
    @Size(min=1,max=20,message = "长度应该在1到20位之间")
    private String ruleName;
    private Integer minValue;
    private Integer maxValue;
    @NotNull(message = "不能为空")
    @Pattern(regexp = "[+]?(([1-9]\\d*[.]?)|(0.))(\\d{0,2})?",message = "金额应该是整数,最多2位数的小数")
    private String feeUnit;
    private Integer ruleStatus;

    @NotNull(message = "不能为空")
    private Long villageId;

    @NotNull(message = "不能为空")
    private Long buildingTypeId;

    public Long getVillageId() {
        return villageId;
    }

    public void setVillageId(Long villageId) {
        this.villageId = villageId;
    }

    public WaterRuleDO toDO(){
        WaterRuleDO waterRuleDO  = new WaterRuleDO();
        waterRuleDO.setFeeUnit(PriceUtil.convertPriceYuan(feeUnit));
        waterRuleDO.setRuleStatus(ruleStatus);
        waterRuleDO.setMaxValue(maxValue);
        waterRuleDO.setMinValue(minValue);
        waterRuleDO.setRuleName(ruleName);
        waterRuleDO.setVillageId(villageId);
        waterRuleDO.setBuildingTypeId(buildingTypeId);
        return waterRuleDO;
    }

    public Long getBuildingTypeId() {
        return buildingTypeId;
    }

    public void setBuildingTypeId(Long buildingTypeId) {
        this.buildingTypeId = buildingTypeId;
    }

    public String getRuleName() {
        return ruleName;
    }

    public void setRuleName(String ruleName) {
        this.ruleName = ruleName;
    }

    public Integer getMinValue() {
        return minValue;
    }

    public void setMinValue(Integer minValue) {
        this.minValue = minValue;
    }

    public Integer getMaxValue() {
        return maxValue;
    }

    public void setMaxValue(Integer maxValue) {
        this.maxValue = maxValue;
    }

    public String getFeeUnit() {
        return feeUnit;
    }

    public void setFeeUnit(String feeUnit) {
        this.feeUnit = feeUnit;
    }

    public Integer getRuleStatus() {
        return ruleStatus;
    }

    public void setRuleStatus(Integer ruleStatus) {
        this.ruleStatus = ruleStatus;
    }



}
